All Questions
Tagged with rustmathematics
10 questions
7votes
2answers
1kviews
Program to find three cubes that sum to a fourth cube
I'm writing a Rust program that finds the "first five cubes that can be written as the sum of three distinct nonzero cubes", e.g. 216 = 6^3 = 3^3 + 4^3 + 5^3. The function looks like this: <...
3votes
1answer
209views
Taking array of numbers, having a max weight, and distributing excess weight to ln max weight numbers
The goal is to take an array of numbers, have a max weight (saying 40%), and if any number above the max_num = sum * weight is present, remove the excess and ...
3votes
1answer
604views
Fast approximate sin/cos function in Rust
Over the past month or so, I’ve been trying to create an extremely fast, platform agnostic, auto-vectorizing sin/cos function for fun. I initially started with sleef-rs’s fast sin function, and ...
3votes
1answer
221views
Find factor pairs of an integer in Rust
I'm trying to efficiently generate all pairs of factors of a number n. For example, when n=27, the factor pairs are (1, 27), (3, 9), (9, 3), (27, 1) The order in which the pairs are found is not ...
3votes
1answer
170views
Willans' formula in Rust
I implemented Willans' formula to calculate the nth prime number in Rust: ...
1vote
1answer
280views
Simple math library in Rust
So, I've tried to make a simple math library in Rust. What do you think about it? ...
2votes
1answer
249views
Z^m number system in Rust version 2
A \$Z^m\$ number system includes integers in the interval \$[0, m)\$ when \$m > 0\$ or \$(m, 0]\$ when \$m < 0\$. The code defines a trait Mod to represent ...
2votes
1answer
725views
Z^m number system in Rust
A \$Z^m\$ number system includes integers in the interval \$[0, m)\$ when \$m > 0\$ or \$(m, 0]\$ when \$m < 0\$. The code defines a trait Mod to represent ...
11votes
1answer
2kviews
Lotto simulator
With the recent craziness of the Powerball in the US, I got interested in building a little lotto simulator to see how frequently I could win with purchasing large amounts of tickets. For those not ...
5votes
0answers
904views
Recursive factorial calculations in Rust
I am trying to calculate very large factorials. I am looking to speed it up as 10000! takes approximately a minute and a half. ...